import type {LoginForm} from "@/views/login/types/loginType.ts";
import {axiosHttp} from "@/util/axios.ts";
import type {Result} from "@/common/comTypes/commonTypes.ts";

const loginUrl = "/login"

export function login(from: LoginForm): Promise<Result<any>> {

    const formData = new FormData();
    for (const key in from) {
        if (from.hasOwnProperty(key)) {
            formData.append(key, from[key]);
        }
    }
    return axiosHttp.post(loginUrl, formData, {
        'Content-Type': 'multipart/form-data'
    })
}